package com.linktrip.devicemanager.task;

import java.util.concurrent.Callable;

import com.linktrip.devicemanager.util.Constant;
import com.linktrip.devicemanager.util.ToolKits;

/**
 * @author : CaineZhu E-mail:CaineZhu@me.com
 * @version : V1.0
 * @创建时间 ： 2017年5月27日 上午11:55:45
 * @类说明 : blablabla
 */
public class UnlockTask implements Callable<Integer> {
	private String key;

	public UnlockTask(String key) {
		this.key = key;
	}

	@Override
	public Integer call() throws Exception {
		int i = Constant.DEFAULT_TRY_TIME;
		int status = 0;
		while (status != 2 && i > 0) {
			Thread.sleep(2000);
			status = ToolKits.getMessageByKey(key);
			if (status == 2)
				break;
			i--;
		}
		return status;
	}

}
